#include "WPILib.h"
#include "XboxJoystick.hpp"

/**
 *  Constructor for XboxJoystick.
 * 	
 * 	@param joystickPort The port number that the XBox controller is plugged into.
 */
XboxJoystick::XboxJoystick(int joystickPort) :
	Joystick(joystickPort)
{
}

/**
 *  Destructor for XboxJoystick.
 */
XboxJoystick::~XboxJoystick()
{
}

/**
 *  Get the current value of the specified axis.
 *  
 *  @param axis The XboxAxis to read from.
 *  @return The current value of the axis.
 */
double XboxJoystick::GetAxisValue(XboxAxis axis)
{
	return GetRawAxis(axis);
}

/**
 *  Get the current value of the specified button.
 *  
 *  @param button The XboxButton to read from.
 *  @return The value of the button.
 */
bool XboxJoystick::GetButton(XboxButton button)
{
	return GetRawButton(button);
}

/**
 *  Get whether the right trigger (RT) is mostly pressed.
 *  
 *  @return Whether the right trigger (RT) is mostly pressed.
 */
bool XboxJoystick::GetRightTrigger()
{
	return GetRawAxis(3) > .5;
}

/**
 *  Get whether the left trigger (LT) is mostly pressed.
 *  
 *  @return Whether the left trigger (LT) is mostly pressed.
 */
bool XboxJoystick::GetLeftTrigger()
{
	return GetRawAxis(3) < -.5;
}
